#include <stdio.h>
#include <graphics.h>
#include <conio.h>
#include <dos.h>
#include <malloc.h>
#include <math.h>
void appear(int tr,int tg,int tb,int fr,int fg,int fb)
{
	while(1)	{
		if(fr<tr)
			fr++;
		else if(fr>tr)
			fr--;
		if(fg<tg)
			fg++;
		else if(fg>tg)
			fg--;
		if(fb<tb)
			fb++;
		else if(fb>tb)
			fb--;
		if(fr==tr && fg==tg && fb==tb)
			break;
		setrgbpalette(1,fr,fg,fb);
		delay(10);
	}
}

#define pi 3.1415926535897

void main()
{
	char far *image;
	int gdriver=DETECT,gmode,i=0;
	long size;
	initgraph(&gdriver,&gmode,"");
	setrgbpalette(0,0,0,0);
	setrgbpalette(1,0,0,0);
	setfillstyle(7,1);
	bar(10,10,100,100);
	delay(3000);
	size=90*90;
	image=(char far *)malloc(size);
	appear(60,60,60,0,0,0);
	getimage(10+i,10+i,100+i,100+i,image);
	for(i=0;i<200;i++)	{
		bar(10+i,10+i,100,100+100*sin(180/pi*i));
		delay(2);
	}
	getch();
}